// import { stringify } from 'qs';
import request from '@/utils/request';
import baseRequest from '@/utils/baseRequest';
import { async } from 'q';
// import mdf from "react-native-md5";

// const BASE_URL = 'http://101.200.59.101/';
// const PRFETO = 'https://goldeye.cfbond.com/';

// 登录
export async function fakeAccountLogin(params) {
  return baseRequest(`/api/user/user_login`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 消息列表
 * @param {*}
 */
export async function getMessageListData(payload) {
  return request(
    `/api/gold/message_list?page_num=${payload.page_num}&page_size=${payload.page_size}`,
    {
      method: 'GET',
      ...payload,
    }
  );
}

/**
 * 订单管理
 * @param {*}
 */
export async function getOrderListData(payload) {
  return request(
    `/api/gold/user_order_list?page_num=${payload.page_num}&page_size=${payload.page_size}`,
    {
      method: 'GET',
      ...payload,
    }
  );
}

/**
 * 主营产品
 * @param {*}
 */
export async function apiGetMainProductList(payload) {
  //page_num=${payload.page_num}&page_size=${payload.page_size}
  return request(
    `/api/gold/main_product_list?page_num=${payload.page_num}&page_size=${payload.page_size}`,
    {
      method: 'GET',
      ...payload,
    }
  );
}
export async function apiAddMainProduct(payload) {
  console.log('payload', payload);
  return request(`/api/gold/main_product_create`, {
    method: 'POST',
    body: {
      ...payload,
    },
  });
}
export async function apiUpdataMainProduct(payload) {
  return request(`/api/gold/main_product_update`, {
    method: 'POST',
    body: {
      ...payload,
    },
  });
}
export async function apiDeleteMainProduct(payload) {
  return request(`/api/gold/main_product_delete`, {
    method: 'POST',
    body: {
      ...payload,
    },
  });
}
/**
 * 关联公司查询
 * @param {*}
 */
export async function apiRelatedCompanyList(payload) {
  //page_num=${payload.page_num}&page_size=${payload.page_size}
  return request(
    `/api/gold/related_company_list?page_num=${payload.page_num}&page_size=${payload.page_size}`,
    {
      method: 'GET',
      ...payload,
    }
  );
}
export async function apiaddRelatedCompany(payload) {
  return request(`/api/gold/related_company_create`, {
    method: 'POST',
    body: {
      company_name: payload.company_name,
      company_type: payload.company_type,
    },
    // ...payload,
  });
}
export async function apiUpdateRelatedCompany(payload) {
  return request(`/api/gold/related_company_update`, {
    method: 'POST',
    body: {
      ...payload,
    },
    // ...payload,
  });
}
export async function apiDeleteRelatedCompany(payload) {
  return request(`/api/gold/related_company_delete`, {
    method: 'POST',
    body: {
      ...payload,
    },
    // ...payload,
  });
}

/**
 * 竞争对手设置
 * @param {*}
 */
export async function apiGetCompetiorData(payload) {
  return request(
    `/api/gold/competitor_list?page_num=${payload.page_num}&page_size=${payload.page_size}`,
    {
      method: 'GET',
      ...payload,
    }
  );
}
export async function apiGetAddCompetiorData(payload) {
  //?company_name=${payload.company_name}&business_type_id=${payload.business_type_id}
  return request(`/api/gold/competitor_create`, {
    method: 'POST',
    body: {
      ...payload,
    },
  });
}
export async function apiUpdateCompetior(payload) {
  return request(`/api/gold/competitor_update`, {
    method: 'POST',
    body: {
      ...payload,
    },
  });
}
export async function apiDeleteCompetior(payload) {
  return request(`/api/gold/competitor_delete`, {
    method: 'POST',
    body: {
      ...payload,
    },
  });
}

/**
 * 获取-首页-雷达图-数据
 * @param {*}
 */
export async function getHrdtData(payload) {
  return request(`/api/gold/business_development_assessment?stock_code=${payload.stock_code}`, {
    method: 'GET',
    ...payload,
  });
}

/**
 * 获取-首页-舆情走势图-数据
 * @param {*}
 */
export async function getHmldData(payload) {
  return request(`/api/gold/info_attr_trend?stock_code=${payload.stock_code}`, {
    method: 'GET',
    ...payload,
  });
}

/**
 * 获取-首页-E互动-数据
 * @param {*}
 */
export async function getHlbtData(payload) {
  return request(`/api/gold/e_interactive?stock_code=${payload.stock_code}`, {
    method: 'GET',
    ...payload,
  });
}

/**
 * 获取-首页-市值变动图-数据
 * @param {*}
 */
export async function getHldtData(payload) {
  return request(`/api/gold/index_info?stock_code=${payload.stock_code}`, {
    method: 'GET',
    ...payload,
  });
}

/**
 * 获取-首页-奇葩指数-数据
 * @param {*}
 */
export async function getQpzs(payload) {
  return request(`/api/gold/exotic_index_abnormal?stock_code=${payload.stock_code}`, {
    method: 'GET',
    ...payload,
  });
}

/**
 * 获取-首页-新闻视频-数据
 * @param {*}
 */
export async function getHomeMeidaList(payload) {
  return request(`/api/gold/special_video_info`, {
    method: 'GET',
    ...payload,
  });
}

/**
 * 消息列表
 */
export async function getMessage(payload) {
  // console.log("payload",payload)
  return request(
    `/api/gold/message_list?page_num=${payload.page_num}&page_size=${payload.page_size}`,
    {
      method: 'GET',
      ...payload,
    }
  );
}

export async function addSmtpEntry(payload) {
  // console.log("params",params)
  return request(`/api/gold/sensitive_period_create`, {
    method: 'POST',
    // ...payload,
    body: payload,
  });
}

export async function getDetail(payload) {
  return request(`/api/gold/public_detail_info?id=${payload.id}&api_type=${payload.api_type}`, {
    method: 'GET',
    ...payload,
  });
}
